package com.myFwk.service.serviceImpl;

import com.rabbitmq.client.Return;
import com.rabbitmq.client.ReturnCallback;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

/**
 * @Title: 主要是对消息从Exchange发送到Queue队列的一个确认机制
 * @Description:
 * @Author: guowl
 * @version： 1.0
 * @Date:2021/10/25
 * @Copyright: Copyright(c)2021 RedaFlight.com All Rights Reserved
 */
@Service
@Slf4j
public class ReturnCallBackService implements RabbitTemplate.ReturnCallback {
    @Override
    public void returnedMessage(Message message, int i, String s, String s1, String s2) {
        System.out.println("===============================================");
        log.info("ReturnCallback 内容：{}", message);
        log.info("ReturnCallback 回应码：{}", i);
        log.info("ReturnCallback 回应信息：{}", s);
        log.info("ReturnCallback 交换机：{}", s1);
        log.info("ReturnCallback 路由键：{}", s2);
    }
}
